package cn.stylefeng.guns.modular.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.modular.entity.ScheduleForm;
import cn.stylefeng.guns.modular.entity.ScheduleFrame;
import cn.stylefeng.guns.modular.mapper.ShareCommunityMapper;
import cn.stylefeng.guns.modular.service.ShareCommunityService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class ShareCommunityServiceImpl  implements ShareCommunityService {
    @Resource
    private ShareCommunityMapper shareCommunityMapper;

    /**
     * 查询所有分享的日程表
     *
     * @return
     */
    public List<ScheduleForm> selectAllShareSform() {
        return shareCommunityMapper.selectAllShareSform();

    }

    /**
     * 查询所有发布的日程框架
     *
     * @return
     */
    public List<ScheduleFrame> selectAllPublishSframe() {
        return shareCommunityMapper.selectAllPublishSframe();

    }

    /**
     * 模糊查询共享的日程表
     * @param keyword
     * @param creatTime
     * @return
     */
    public Page<Map<String, Object>> fuzzyShowShareSform(@Param("keyword") String keyword, @Param("creatTime") String creatTime){
        Page page = LayuiPageFactory.defaultPage();
        System.out.println("==========================="+page);
        return  shareCommunityMapper.fuzzyShowShareSform(page,keyword,creatTime);
    }

    /**
     * 模糊查询已发布日程框架
     * @param keyword
     * @param creatTime
     * @return
     */
    public Page<Map<String, Object>> fuzzyShowShareSframe( @Param("keyword") String keyword,@Param("creatTime") String creatTime){
        Page page = LayuiPageFactory.defaultPage();
        System.out.println("==========================="+page);
        return shareCommunityMapper.fuzzyShowShareSframe(page,keyword,creatTime);
    }
}
